package com.nky.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nky.pojo.RoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 说明一个角色拥有哪些菜单项的权限
 */
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {

    /**
     * 根据角色id和机构id查询用户菜单权限
     *
     * @param roleId        角色id
     * @param institutionId 机构id
     * @return 用户拥有权限的菜单id列表
     */
    @Select("select menu_id from role_menu where role_id = #{roleId} and institution_id = #{institutionId}")
    List<Integer> selectByRoleId(@Param("roleId") Integer roleId, @Param("institutionId") Integer institutionId);
}
